package com.bds.wm.utils;

import java.io.File;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * Created by guoyu on 2018/1/29.
 */
@Configuration
public class Const {
	@Autowired
	Environment environment;
	public static final String FAIL = "fail";

	public static final String SUC = "suc";

	public final static String sessionKey = "sessionContext";
	public final static String verifyCode = "verifyCode";

	public static final String SESSION_USER = "sessionUser";

	public static final String SESSION_USERNAME = "username"; // 用户名

	public static final String COOKIE_KEY = "bds_wm_token"; // 用户名
	public static final String COOKIE_USERNAME = "bds_wm_username"; // 用户名

	public static final String DESKEY = "12345abc";
	public static String Context;
	public static String Host_Ip;
	public static int Host_Port;
	public static String HttpContext;
	public static String ContextPath = "";
	public static String REDIS_IP = "211.152.47.89";
	public static int REDIS_PORT = 6379;
	public static String Zookepper_Nodes;

	public static String Node;
	public static String ZNode;

	public static boolean LOCAL;

	public static final int decimal_num = 4;

	// 文件路径
	public static String FTL_PATH = System.getProperty("user.dir") + File.separator + "ftl";

	@PostConstruct
	public void doStart() {
		String rip = environment.getProperty("redis.ip");
		String rport = environment.getProperty("redis.port");

		Const.REDIS_IP = rip;
		Const.REDIS_PORT = Integer.parseInt(rport);
	}

}
